//
//  LCBaseDatabase+DBDelete.m
//  LCFMDB
//
//  Created by jiukuyinyue on 2017/10/31.
//  Copyright © 2017年 LC. All rights reserved.
//

#import "LCBaseDatabase+DBDelete.h"
@implementation LCBaseDatabase (DBDelete)

- (void)delTable:(NSString *)tableName {
    NSString *sqlstr = [NSString stringWithFormat:@"DELETE FROM %@;",tableName];
    [self.db inDatabase:^(FMDatabase * _Nonnull db) {
        if (![db executeUpdate:sqlstr]){
            NSLog(@"error = %@", [db lastErrorMessage]);
            NSLog(@"Delete table error!");
        }else{
            NSLog(@"Delete table 成功!");
            if (![db executeUpdate:@"VACUUM;"]){
                NSLog(@"释放空间 error!");
            }else{
                NSLog(@"释放空间 成功!");
            }
        }
    }];

}

@end
